import { authStore } from "@/stores/modules/auth";
import { routerStore } from "@/stores/modules/router.ts";

/**
 * @description 页面按钮权限
 * */
export const authButton = (action: string) => {
  const routerState = routerStore();
  const authState = authStore();
  if (authState.user?.is_admin) {
    return true;
  }
  const authKey = action + ":" + routerState.routeId;
  return authState.operations[authKey] || false;
};
